//============================================================================
// Name        : PureVirtualFunc.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C, Ansi-style
//============================================================================

#include <stdio.h>
#include <stdlib.h>

#include "Shape.h"
#include "Point.h"
#include "Circle.h"
#include "Cylinder.h"

using namespace std;
int main(void) {
	Point point(3.2, 4.5);
	Circle circle(2.4, 1.2, 5.6);
	Cylinder cylinder(3.5, 6.4, 5.2, 10.5);

	point.shapeName(); //静态关联
//	cout << point << endl;

	circle.shapeName();
//	cout << circle << endl;

	cylinder.shapeName();
//	cout << cylinder << endl;

	Shape* ptr;
	ptr = &point;
	ptr->shapeName(); //动态关联
	cout << "x=" << point.getX() << ", y=" << point.getY() << "\n" \
			<< "area=" << ptr->area() << "\nvolume=" << ptr->volume() << endl;

	ptr = &circle;
	ptr->shapeName();
	cout << "x=" << circle.getX() << ", y=" << circle.getY() << "\n" \
			<< "area=" << ptr->area() << "\nvolume=" << ptr->volume() << endl;

	ptr = &cylinder;
	ptr->shapeName();
	cout << "x=" << cylinder.getX() << ", y=" << cylinder.getY() << "\n" \
			<< "area=" << ptr->area() << "\nvolume=" << ptr->volume() << endl;

	return 0;
}
